<?
$page_titles=Array("Password Retrieval","Account Information Retreival");

$page_mode=$_GET["mode"];
$page_title=$page_titles[$page_mode];
$mindex=1;
?>
<?include("includes/header.php") ?>
<?
if($_POST){

	$memberShipId=$_REQUEST["txtLoginId"];
	$emailId=$_REQUEST["txtEmailId"];
	if($page_mode==0)
		$retFlag=sendPassword($memberShipId,$emailId);
	else
		$retFlag=sendLoginRequest($memberShipId,$emailId);
		
	writeLog("Member :".$emailId." requested login info");
}

$error_msg=Array("","","Invalid Membership ID. Please Check.","Invalid Email Id. Please try again.","Could not able to send mail. Please try later");

?>

<?if($page_mode==0){?>

<p>You can retrieve your forgotten password by entering your membership id and email id. The login details will be mailed to you if the provided information are valid. If you are not sure about your Member Id then Click <a href="forgotpwd.php?mode=2">here</a> to  retreive your account details.</p>
<div class="break"></div>
	<?if($_POST && $retFlag>1){ ?>
	<div class="errorBox" ><?=$error_msg[$retFlag]?></div><br/>
	<?}else if($_POST && $retFlag==1){ ?>
	<div class="msgBox" >Login info sent to your email. Please check</div><br/>
	<? } ?>
<div>
	<form method="post" action="forgotpwd.php?mode=<?=$_GET["mode"]?>" name="frmPassword" onsubmit="return validateForm(this,0)" >
		<div style="width:300px" class="label_12">
			<b>Enter your Membership  Id</b> : <br/>
			<input type="text" size="35" name="txtLoginId" class="txtbox capital" maxlength="12"/><br/><br/>
			<b>Enter your email id </b>: <br/>
			<input type="text" size="35" name="txtEmailId" class="txtbox"/>
			<br/><br/>
			<input type="submit" value="Submit" class="button" style="margin-right:1px"/>
			<input type="button" value="Cancel" class="button" onclick="javascript:history.back()"/>
		
		</div>
	</form>	
</div>
<? }else{ ?>

<p>You can retrieve your Account information by sending a email request to <a mailto="itncomm@bkconnect.net">itncomm@bkconnect.net</a> with your  Name & Email Id. Alternatively you can send the request by filling the following information and click "Request Account Info"</p>
<p>You will be receiving the Account Information via  EmailId Provided within 2 days</p>
<div class="break"></div>
	<?if($_POST && $retFlag>1){ ?>
	<div class="errorBox" ><?=$error_msg[$retFlag]?></div><br/>
	<?}else if($_POST && $retFlag==1){ ?>
	<div class="msgBox" >Login info sent to your email. Please check</div><br/>
	<? } ?>
<div>
	<form method="post" action="forgotpwd.php?mode=<?=$_GET["mode"]?>" name="frmPassword" onsubmit="return validateForm(this,1)" >
		<div style="width:490px" class="label_12">
			<b>Enter your Full Name </b>: <br/>
			<input type="text" size="35" name="txtLoginId" class="txtbox capital" maxlength="12"/><br/><br/>
			<b>Enter your Email id </b>: ( The emailid which you have used while registration)<br/>
			<input type="text" size="35" name="txtEmailId" class="txtbox"/>
			<br/><br/>
			<input type="submit" value="Submit" class="button" style="margin-right:1px"/>
			<input type="button" value="Cancel" class="button" onclick="javascript:history.back()"/>
		
		</div>
	</form>	
</div>
<? } ?>

<script type="text/javascript">
function validateForm(vForm,vMode){

var msg="Please correct the errors:\n\n";
var eMode=0;

if(vForm.txtLoginId.value==""){
eMode=1;
if(vMode==1)
 msg +=" Name  field cannot be empty.\n\n";
 else
msg +=" Membership ID field cannot be empty.\n\n";
}
if(vForm.txtEmailId.value==""){
	eMode=1;
	msg +=" Email field cannot be empty.\n\n";
}

if(eMode==1){
alert(msg);
return false;
}

}

</script>

<?include("includes/footer.php") ?>